<div class="panel panel-default">
  <div class="panel-heading"><?= empty($data) ? '添加教师' : '编辑教师' ?></div>
  <div class="panel-body">
    <form action="" method="post" class="form-horizontal">
      <fieldset>
        <?php if (!empty($data)): ?>
          <input type="hidden" name="user_id" value="<?= $data->user_id ?>">
          <?php else: ?>
          <?= CHtml::hiddenField('type', 2) ?>
        <?php endif ?>
        <div class="form-group">
          <label for="username" class="control-label col-md-1">账号</label>

          <div class="col-md-2">
            <?php if (empty($data)): ?>
              <input type="text" name="username" id="username" maxlength="24" required="" autofocus=""
                     placeholder="请输入教师账号" class="form-control">
            <?php else: ?>
              <p class="form-control-static"><?=$data->username?></p>
              <div class="help-block">教师账号为其登录的唯一凭证，无法更改</div>
            <?php endif ?>
          </div>
        </div>
        <div class="form-group">
          <label for="password" class="control-label col-md-1">密码</label>

          <div class="col-md-2">
            <input type="text" name="password" id="password" <?= empty($data) ? 'required=""' : '' ?>
                   placeholder="<?= empty($data) ? '请输入密码' : '不修改请留空' ?>" class="form-control">
          </div>
        </div>
        <div class="form-group">
          <label for="name" class="control-label col-md-1">姓名</label>

          <div class="col-md-2">
            <input type="text" name="name" id="name" required="" placeholder="请输入教师姓名"
                   value="<?= empty($data) ? '' : $data->name ?>" class="form-control">
          </div>
        </div>
        <div class="form-group">
          <div class="col-md-2 col-md-offset-1">
            <button type="submit" class="btn btn-primary btn-block">提交</button>
          </div>
        </div>
      </fieldset>
    </form>
  </div>
</div>